package Orm.jdbc.ormdiy;

import java.sql.SQLException;

public class Test {

    public static void main(String[] args) throws SQLException {
//        City city = new City();
//        city.setId(4080);
//        city.setName("yanjd");
//        city.setCountryCode("PSE");
//        new Test().updateCity(city);
        new Test().queryCity();
    }

    public void queryCity() throws SQLException {
        City city = WaterRepositoryImp.query("select * from city where id = ?",City.class,4080);
        System.out.println(city);
    }

    public void updateCity(City city) throws SQLException {
        String sql = "update city set name=?,countryCode=? where id =?";
        Object[] params = { city.getName(),city.getCountryCode(),city.getId() };
        WaterRepositoryImp.update(sql, params);
    }

}
